package com.yy.wga.wechat.feign.api;

import com.yy.wga.common.core.dto.Result;
import com.yy.wga.wechat.feign.api.config.WechatFeignRequestInterceptor;
import com.yy.wga.wechat.feign.request.WechatMaSubscribeMessageReq;
import com.yy.wga.wechat.feign.response.WechatGetAccessTokenResp;
import com.yy.wga.wechat.feign.response.WechatMJscode2SessionResp;
import com.yy.wga.wechat.feign.response.WechatOAuth2AccessTokenResp;
import jakarta.validation.Valid;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * @author 17674
 */
@FeignClient(name = "WechatMpFeign", url = "https://wga-api.xianrcj.com/api/wechat/mp/",
        configuration = WechatFeignRequestInterceptor.class)
public interface WechatMpFeign {
    /**
     * 通过code获取用户信息
     *
     * @param code code
     * @return WechatMJscode2SessionResp
     */
    @PostMapping("getUserSessionInfo")
    Result<WechatMJscode2SessionResp> getUserSessionInfo(@RequestParam("code") String code);

    /**
     * 获取公众号用户信息
     *
     * @param code code
     * @return WechatOAuth2AccessTokenResp
     */
    @PostMapping("getOfficialOAuth2AccessToken")
    Result<WechatOAuth2AccessTokenResp> getOfficialOAuth2AccessToken(@RequestParam("code") String code);

    /**
     * 获取accessToken
     *
     * @return WechatGetAccessTokenResp
     */
    @PostMapping("getAccessToken")
    Result<WechatGetAccessTokenResp> getAccessToken();

    /**
     * 获取视频号accessToken
     *
     * @return WechatGetAccessTokenResp
     */
    @PostMapping("getChannelAccessToken")
    Result<WechatGetAccessTokenResp> getChannelAccessToken();

    /**
     * 发送推送
     *
     * @param request WechatMaSubscribeMessageReq
     * @return Boolean
     */
    @PostMapping("sendSubscribeMsg")
    Result<Boolean> sendSubscribeMsg(@RequestBody @Valid WechatMaSubscribeMessageReq request);
}
